package com.zhanghe.study.sqlsession;

import com.zhanghe.study.config.MyConfig;

import java.lang.reflect.Proxy;

public class MySqlSession {
    private Executor executor = new MyExecutor();

    private MyConfig config = new MyConfig();

    public <T> T selectOne(String statement,Object parameter){
        return executor.query(statement,parameter);
    }

    public <T> T getMapper(Class<T> tClass){
        return (T) Proxy.newProxyInstance(tClass.getClassLoader(),new Class[]{tClass},new MyMapperProxy(this,config));
    }
}
